package lab02.test11;

//正方形

public class Square extends Rectangle {

    //属性：边长

    double z;

    //行为：赋值，对角线

    Square(double x, double y) {
        super(x, y);
    }

    double diagonal(){

        z=Math.sqrt(length*length+width*width);

        return z;
    }

    @Override
    public void printMyWay() {

        System.out.println("该正方形的长length="+length);

        System.out.println("该正方形的宽width="+width);

        System.out.println("面积area="+area());

        System.out.println("周长perimeter="+perimeter());

        System.out.println("对角线z="+diagonal());
    }
}
